<?php
ob_start();
include('inc_config.php');
ob_clean();

$title          = getValue('title','str','POST','');
$title_md5      = md5($title);
$new_picture    = getValue('new_picture','str','POST','');
$teaser         = getValue('new_teaser','str','POST','');
$taggets        = getValue('new_tags','str','POST','');
$cat_id         = getValue('cat_id','int','POST',0);
$description    = getValue('new_detail','str','POST','');
$link_url       = getValue('new_link','str','POST','');
$time           = time() - 3600;
$msgerror = '';
$myform = new generate_form();
$myform->addTable('news');
$myform->removeHTML(0);
$myform->add('new_title','title',0,1,"",0,"",1,'Trùng nội dung tin');
$myform->add('new_title_md5','title_md5',0,1,'',0,"",1,"Trùng tin - tin đã lấy");
$myform->add('new_picture','new_picture',0,1,'',0);
$myform->add('new_teaser','teaser',0,1,"",0,"",0);
$myform->add('new_tags','taggets',0,1,'',0);
$myform->add('new_cat_id','cat_id',1,1,0,0,'',0);
$myform->add('new_detail','description',0,1,"",0,"",0);
$myform->add('new_date','time',1,1,0,0,'',0);
$myform->add('new_link','link_url',0,1,'',0,'',0);
$msgerror  .= $myform->checkdata();
if($msgerror == ""){
    //echo $myform->generate_insert_SQL();
    $db_insert = new db_execute($myform->generate_insert_SQL());
    //echo 'Lấy thành công tin: <a href='.$link_url.' target="_blank">'.$title.'</a>';
    //echo $description;
    echo 'success';
    unset($db_insert);
}else{    
    echo 'Lỗi dữ liệu';
    echo $msgerror;
}
?>